package ch05.embedded;

import ch05.embedded.ExprNode;
import ch05.Token;

/**
 * 赋值节点
 */

public class AssignNode extends StatNode{
    VarNode id;
    ExprNode value;
    public AssignNode(VarNode id, Token token, ExprNode value) {
        super(token);
        this.id = id;
        this.value = value;
    }

    public void print() {
        id.print();                     // 遍历左子节点
        System.out.print("=");        // 输出操作符
        value.print();                  // 遍历右子节点
        System.out.println();
    }
}
